/*
 * @Author: fisher
 * @Date: 2022-12-18 21:47:27
 * @LastEditTime: 2022-12-23 21:43:47
 * @LastEditors: your name
 * @Description:
 * @FilePath: /vite-vue-ts-h5/src/store/modules/homeStore.ts
 * 可以输入预定的版权声明、个性签名、空行等
 */
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'

export const useHomeStore = defineStore('home', () => {
  const count = ref(0)
  function addCount(value: number): void {
    count.value += value
  }

  const countAdd100 = computed(() => count.value + 100)

  return {
    count,
    countAdd100,
    addCount
  }
})

// export const useHomeStore = defineStore('home', {
//   state: () => ({
//     count: 0
//   }),
//   getters: {
//     countAdd100(state) {
//       return state.count + 100
//     }
//   },
//   actions: {
//     addCount(value: number) {
//       this.count += value
//     }
//   }
// })
